/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package ControlLayer;

import DBLayer.DBInvoice;
import DBLayer.IFDBInvoice;
import ModelLayer.Invoice;

/**
 *
 * @author Henrik-iMac
 */
public class CtrInvoice {
    public CtrInvoice(){
    }

    public Invoice findInvoiceById(int invoiceNo){
        IFDBInvoice dbInvoice = new DBInvoice();
        return dbInvoice.findInvoiceById(invoiceNo);
    }

    //insert a new invoice
    public int insertInvoice(Invoice invoice){
        IFDBInvoice dBInvoice = new DBInvoice();
        return dBInvoice.insertInvoice(invoice);
    }

    //update information about a invoice
    public int updateInvoice(int invoiceNo, String paymentDate, double amount){
        IFDBInvoice dBInvoice = new DBInvoice();
        Invoice i = new Invoice();
        i.setInvoiceNo(invoiceNo);
        i.setPaymentDate(paymentDate);
        i.setAmount(amount);
        return dBInvoice.updateInvoice(i);
    }

}
